package com.hsp.Demo_03_object;

import java.util.Scanner;

public class Demo_02 {
    public static void main(String[] args) {
        /*
        创建一个方法，方法接收一个整数，然后判断该整数是偶数还是奇数
       为偶数，返回true，为奇数，返回false
         */
        AA aa = new AA();
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入一个整数：");
        int i = scanner.nextInt();
        /*if(aa.isOdd(i)){
            System.out.println( i + "是个整数");
        }else{
            System.out.println( i + "是个整数");
        }*/
        System.out.println(aa.isOdd(i) ? i + "是个偶数" : i + "是个奇数");
    }
}

class AA{

    public boolean isOdd(int num){
        return num % 2 == 0;
    }
}
